package com.peak.distribution.entity.sales;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;

import com.peak.distribution.entity.agent.DisAgent;
import com.peak.distribution.entity.agent.DisAgentTeam;
import com.peak.distribution.enums.Constants;

import lombok.Getter;
import lombok.Setter;

@Entity
@Table(name = "dis_agent_sales_quarter_log")
@Getter
@Setter
public class DisAgentSalesQuarterLog extends SalesLog {

	private static final long serialVersionUID = Constants.DISTRIBUTION_VERSION;

	/** 销售年 */
	private Integer salesYear;
	
	/** 销售季度 */
	private Integer salesQuarter;
	
	/** 代理商 */
	private DisAgent agent;
	
	/** 代理团队 */
	private DisAgentTeam team;
	
	@ManyToOne
	@JoinColumn(name = "agent_id")
	@Fetch(FetchMode.SELECT)
	@LazyToOne(LazyToOneOption.PROXY)
	public DisAgent getAgent() {
		return agent;
	}
	
	@ManyToOne
	@JoinColumn(name = "team_id")
	@Fetch(FetchMode.SELECT)
	@LazyToOne(LazyToOneOption.PROXY)
	public DisAgentTeam getTeam() {
		return team;
	}
}
